<?php
namespace app\model;

use app\steps\Check;
use app\steps\Input;
use app\steps\Withdrawal;
use tpScriptVueCurd\FieldCollection;
use tpScriptVueCurd\option\generate_table\GenerateTableOption;

/**
 * 需要继承 \tpScriptVueCurd\base\model\BaseModel 模型类
 * Class Project
 * @package app\model
 */
class Project extends \tpScriptVueCurd\base\model\BaseModel
{
    /**
     * 关联的控制器配置
     * @return string
     */
    public static function getControllerClass(): string
    {
        return \app\controller\Project::class;
    }

    /**
     * 表字段配置
     * @return FieldCollection
     * @throws \think\Exception
     */
    public function fields(): FieldCollection
    {
        return FieldCollection::make([
            ...Input::make()->getFields()->all(),
            ...Check::make()->getFields()->all(),
            ...Withdrawal::make()->getFields()->all(),
        ])->step(true);
    }

    public function generateTable(GenerateTableOption $table): bool
    {
        $table->setModifyColumn(true);
        return true;
    }
}